{template 'common/header'}
<form action="{php echo $this->createWebUrl('taskadd')}" method="post" class="form-horizontal form" id="setting-form">
    <div class="panel panel-default">
			<div class="panel-heading">游戏参数设置</div>
			<div class="panel-body">
				<div class="tab-content">
					<div class="tab-pane active" style="padding:20px;">

                          <div class="form-group">
                                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">状态：</label>
                                    <div class="col-xs-12 col-sm-9">
                                       <label class="checkbox-inline">
                                          <input type="radio" name="status" value="0" checked="checked"> 下线
                                       </label>
                                       <label class="checkbox-inline">
                                          <input type="radio" name="status" value="1"> 上线
                                       </label>                     
                                    </div>
                          </div>  

                          <div class="form-group">
                                <div class="input-group">
                                    <span class="input-group-addon">游戏任务名称：</span>
                             
                                    <input type="text" name="taskname" class="form-control">
                                </div>
                                
                           </div>
                          <div class="form-group">
                                <div class="input-group">
                                    <span class="input-group-addon">游戏任务排序号：</span>
                             
                                    <input type="text" name="taskorder" class="form-control">
                                </div>
                                
                           </div>
                         <div class="form-group">
                                <div class="input-group">
                                    <span class="input-group-addon">游戏任务图标：</span>
                             
                                    {php echo tpl_form_field_image("taskheadimg");}
                                </div>
                                
                           </div>
                         <div class="form-group">
                                <div class="input-group">
                                    <span class="input-group-addon">游戏任务描述：</span>
                             
                                    <input type="text" name="taskmessage" class="form-control">
                                </div>
                                
                           </div>
                          <div class="form-group">
                                <div class="input-group">
                                    <span class="input-group-addon">任务对应项目：</span>
                             
                             		<select class="form-control" name="tasktoitemid" id="tasktoitemid">
                             				{loop $itemlist $itemkey $itemvalue}
	                             			<option value='{$itemvalue[id]}'>{$itemvalue[itemname]}</option>
	                             			{/loop}
                             		</select>
                                </div>
                                
                           </div>
                           <script type="text/javascript">
                           		$("#tasktoitemid").change(function(){
                           			var id = $("#tasktoitemid").val();
                           			$.post("{php echo $this->createWebUrl('gamefishlist')}",{id:id},function(data){
                           				$object = $.parseJSON(data);
                           				
                           				$(".fishname").children().remove();
                           				for(var i=0;i<$object.length;i++){
                           					$(".fishname").append('<option value="'+$object[i].fishname+'">'+$object[i].fishname+'</option>');
                           				}
                           				$(".deletebutton").click();
                           			})
                           		})
                           </script>
                          <div class="form-group">
                          		<div class="input-group">
                          			<span class="input-group-addon">任务每天</span>
                                       <label class="checkbox-inline">
                                          <input type="radio" name="everyday" value="1" checked="checked">是
                                       </label>
                                       <label class="checkbox-inline">
                                          <input type="radio" name="everyday" value="0"> 否
                                       </label>                     
                          </div>  
                          <div class="form-group" style="margin-top:20px;">
                                <div class="input-group">
                                    <span class="input-group-addon">任务时间：</span>
                                    {php echo tpl_form_field_daterange("betweentime");}
                                </div>
                           </div>
                         <div class="form-group">
                                <div class="input-group">
                                    <span class="input-group-addon">虚拟中奖滚动数据：（用逗号隔开）</span>
                             		
                                    <input type="text" name="dummy" class="form-control">
                                </div>	
                                
                           </div>
                          <div class="form-group">
                          		<div class="input-group">
                          			<span class="input-group-addon">任务类型</span>
                                       <label class="checkbox-inline">
                                          <input type="radio" id="type1" name="tasktype" value="0" checked="checked"> 首次参与奖励
                                       </label>
                                       <!--<label class="checkbox-inline">
                                          <input type="radio" id="type2" name="tasktype" value="1"> 捕获指定对象数量奖励
                                       </label>
										<label class="checkbox-inline">
                                          <input type="radio" id="type3" name="tasktype" value="2"> 无
                                       </label>        
                                         -->               

                          </div>  
                          <script type="text/javascript">
                          	$("#type1").click(function(){
                          		$(".typeinputone").show();
                          		$(".typeinputtwo").hide();
                          	})
                          	$("#type2").click(function(){
                          		$(".typeinputone").hide();
                          		$(".typeinputtwo").show();
                          	})                          
                          	</script>
                         <div class="form-group typeinputone"  style="margin-top:30px;">
                                <div class="input-group">
                                    <span class="input-group-addon">首次参与奖励</span>
                             		
                                    <input type="text" name="firstplayget" class="form-control">
                                </div>	
                                
                           </div>
                          <div class="form-group typeinputtwo"style="margin-top:30px;display:none">
                                <div class="input-group">
                                	<span class="input-group-addon">钓到</span>
                                	<select name="fishname" class="form-control fishname">
                                		<option></option>
                                	</select>
                                    <span class="input-group-addon">鱼</span> 
     								<input type="text" name="fishnum" value="" class="form-control" />
                                    <span class="input-group-addon">条奖励</span> 
                                    <input type="text" name="fishgetpoint" value="" class="form-control">
                                    <span class="input-group-addon addbutton">+</span> 
                                </div>
                                </div>
                           </div>

                           <input type="submit" class="btn btn-primary" id="submitbutton" name="submit" value="提交"  style="margin-top:20px;"/>
                           <input type="hidden" name="token" value="{$_W['token']}"/>
					</div>
				</div>
			</div>
		</div>

 
	</form>
                           <script>
                           		var clicktime = 1;
                           		$(".addbutton").on('click',function(){
                           			$("#submitbutton").before('<div id="btn'+clicktime+'" class="form-group typeinputtwo"style="margin-top:30px"><div class="input-group"><span class="input-group-addon">钓到</span><select name="fishname"class="form-control fishname"><option></option></select><span class="input-group-addon">鱼</span><input type="text"name="fishnum"value=""class="form-control"/><span class="input-group-addon">条奖励</span><input type="text"name="fishgetpoint"value=""class="form-control"><span class="input-group-addon deletebutton">-</span></div></div></div>');
                           			var id = $("#tasktoitemid").val();
                           			$.post("{php echo $this->createWebUrl('gamefishlist')}",{id:id},function(data){
                           				$object = $.parseJSON(data);
                           				$(".fishname").children().remove();
                           				for(var i=0;i<$object.length;i++){
                           					$(".fishname").append('<option value="'+$object[i].fishname+'">'+$object[i].fishname+'</option>');
                           				}
                           			})
                           			clicktime++;
                           		})
                           		$(".tab-pane").on('click','.deletebutton',function(e){
                           			var id = $(this).parent().parent().attr("id");
                           			$("#"+id).remove();
                           		});
                           </script>
{template 'common/footer'}